﻿#include <iostream>
#include <string>

using namespace std;

int main(int argc, char *argv[])
{

    string s1;
    string s2 = s1;  // copy构造

    // s1, s2 address is not same.
    cout << "s1 address: " << &s1 << "\t empty: "<< s1.empty() << "\t size: " << s1.size() << endl;
    cout << "s2 address: " << &s2 << endl;


    string s3("hello");
    s2 = s3;  // 赋值
    cout << "s2 address: " << &s2 << "\t content: "<< s2 << endl;
    // s3.size() 不像char * 后面有 '\null'
    cout << "s3 address: " << &s3 << "\t empty: "<< s3.empty() << "\t size: " << s3.size() << endl;
    return 0;
}
